package com.foryou.swkj.core.util;

/**
 * 响应结果生成工具
 */
public class ResultGenerator {
    private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";

    public static JsonResult genSuccessResult() {
        JsonResult<Object> jsonResult = new JsonResult<>();
        jsonResult.setData(null);
        jsonResult.setMsg(JsonResult.SUCCESS.getDesc());
        jsonResult.setStatus(JsonResult.SUCCESS.getCode());
        return jsonResult;
    }

    public static JsonResult genSuccessResult(Object data) {
        JsonResult<Object> jsonResult = new JsonResult<>();
        jsonResult.setData(data);
        jsonResult.setMsg(JsonResult.SUCCESS.getDesc());
        jsonResult.setStatus(JsonResult.SUCCESS.getCode());
        return jsonResult;
    }

    public static JsonResult genFailResult(String message) {
        JsonResult<Object> jsonResult = new JsonResult<>();
        jsonResult.setData(null);
        jsonResult.setMsg(JsonResult.FAIL.getDesc());
        jsonResult.setStatus(JsonResult.FAIL.getCode());
        return jsonResult;
    }
}
